package cn.cs.service;

import cn.cs.mapper.RepairBbsTypeMapper;
import cn.cs.mapper.SetPolicyMapper;
import cn.cs.pojo.RepairBbsType;
import cn.cs.pojo.SetPolicy;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


@RestController
public class SetPolicyService {

    @Resource
    private SetPolicyMapper setPolicyMapper;


    @RequestMapping(value = "/getSetPolicyById", method = RequestMethod.POST)
    public SetPolicy getSetPolicyById(@RequestParam("id") String id) throws Exception{
        return setPolicyMapper.getSetPolicyById(id);
    }

    @RequestMapping(value = "/getSetPolicyListByMap", method = RequestMethod.POST)
    public List<SetPolicy> getSetPolicyListByMap(@RequestBody Map<String, Object> param) throws Exception{
        return setPolicyMapper.getSetPolicyListByMap(param);
    }

    @RequestMapping(value = "/getSetPolicyCountByMap", method = RequestMethod.POST)
    public Integer getSetPolicyCountByMap(@RequestBody Map<String, Object> param) throws Exception{
        return setPolicyMapper.getSetPolicyCountByMap(param);
    }

    @RequestMapping(value = "/addSetPolicy", method = RequestMethod.POST)
    public Integer addSetPolicy(@RequestBody SetPolicy setPolicy) throws Exception{
        return setPolicyMapper.insertSetPolicy(setPolicy);
    }

    @RequestMapping(value = "/modifySetPolicy", method = RequestMethod.POST)
    public Integer modifySetPolicy(@RequestBody SetPolicy setPolicy) throws Exception{
        return setPolicyMapper.updateSetPolicy(setPolicy);
    }

    @RequestMapping(value = "/deleteSetPolicyById", method = RequestMethod.POST)
    public Integer deleteSetPolicyById(@RequestParam("id") Long id) throws Exception{
        return setPolicyMapper.deleteSetPolicyById(id);
    }

    @RequestMapping(value = "/getSetPolicyByType", method = RequestMethod.POST)
    public Map<String, Object> getSetPolicyByType(@RequestParam("type") String type) throws Exception{
        return setPolicyMapper.getSetPolicyByType(type);
    }


}
